<%@ Language=VBScript %>
<%Option Explicit%>

<!--#include file="../cons.asp"-->
<!--#include file="../../Common/Database.asp"-->

<%
	response.CacheControl = "no-cache"

	Dim oRSAlumnos
	Dim InsDel, IdAlumno, IdQuincena, CuECu
	
	InsDel = Request("InsDel")
	IdAlumno = Request("IdAlumno")
	IdQuincena = Request("IdQuincena")
	CuECu = Request("CuECu")
	
	FirmarPlanilla InsDel, IdAlumno, IdQuincena, CuECu
	



Private function FirmarPlanilla(InsDel, IdAlumno, IdQuincena, CuECu)

	Dim oConn, sSQL, oRS

	Set oConn = OpenConnection
	
	if trim(InsDel) = "I" then
		sSQL = "insert into PlanillasFirmadas values(" & IdAlumno & "," & IdQuincena & ",'" & CuEcu & "')"
	else
		sSQL = "delete from PlanillasFirmadas where IdAlumno = " & IdAlumno & " and IdColegioQuincena = "& IdQuincena & " and CuEcu = '" & CuEcu & "'"
	end if

	'response.Write sSQL
	'response.End	
	Set oRS = oConn.Execute(sSQL)
	
End function

Public function GetNotaDecCol(nota, idec)
	Dim sNota, iNotaConvert
	
	iNotaConvert = FormatNumber(nota, idec)
	
	sNota = "<font color="""
	if iNotaConvert >= 0 and iNotaConvert < 4 then
		sNota = sNota & "red"
	end if
	
	if iNotaConvert >= 4 and iNotaConvert < 6 then
		sNota = sNota & "green"
	end if
	
	if iNotaConvert >= 6 and iNotaConvert <= 10 then
		sNota = sNota & "blue"
	end if
	
	sNota = sNota & """>" & iNotaConvert & "</font>"
	GetNotaDecCol = sNota
End function
%>